package com.cs.contract.controller;

import com.cs.contract.service.CsDeviceService;
import com.cs.contract.domain.CsDevice;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author：zrx
 * @Package：com.cs.controller
 * @Project：RuoYi-Cloud
 * @name：CsDeviceController
 * @Date：2024/11/20 17:45
 * @Filename：CsDeviceController
 */
@RestController
@RequestMapping("/device")
public class CsDeviceController extends BaseController {
    private final CsDeviceService csDeviceService;

    public CsDeviceController(CsDeviceService csDeviceService) {
        this.csDeviceService = csDeviceService;
    }

    @GetMapping("/list")
    public TableDataInfo list(CsDevice csDevice) {
        startPage();
        System.out.println("csDevice:" + csDevice);
        List<CsDevice> list = csDeviceService.listCsDevice(csDevice);
        return getDataTable(list);
    }

    @GetMapping(value = "/{tid}")
    public AjaxResult getInfo(@PathVariable("tid") String tid) {
        return success(csDeviceService.getCsDeviceByTid(tid));
    }
}
